package cn.edu.baiyunu.myapplication.ui.utils

import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Date
import java.util.Locale

/**
 * 格式化日期为"MM月dd日 星期几"的格式
 */
fun formatToDateString(timestamp: Long): String {
    val date = Date(timestamp)
    val calendar = Calendar.getInstance().apply {
        time = date
    }
    
    val dayOfWeek = when (calendar.get(Calendar.DAY_OF_WEEK)) {
        Calendar.SUNDAY -> "星期日"
        Calendar.MONDAY -> "星期一"
        Calendar.TUESDAY -> "星期二"
        Calendar.WEDNESDAY -> "星期三"
        Calendar.THURSDAY -> "星期四"
        Calendar.FRIDAY -> "星期五"
        Calendar.SATURDAY -> "星期六"
        else -> ""
    }
    
    val format = SimpleDateFormat("MM月dd日", Locale.getDefault())
    return "${format.format(date)} $dayOfWeek"
} 